import { MainUtlis } from "../mainUtlis";
import { MainEvent } from "./mainEvent";

export class mainEventMgr{
    private static  _ins:mainEventMgr;
    static get ins(){
        if(!this._ins){
            this._ins=new mainEventMgr();
        }
        return this._ins;
    }

    /**初始化 */
    init(){
        MainEvent.on('selectSpine',this.selectSpine.bind(this));
    }

    /**选择Spine动画 */
    async selectSpine(){
        let paths=await MainUtlis.selectLocalFiles();
        if(!paths){return;}
        let assets=await MainUtlis.identifyByPaths(paths);
        if(!assets){return;}

        let version=MainUtlis.getAssetSpineVersion(assets);
        assets['version']=version;

        console.log('识别的资源', assets);
        return assets;
    }


}